package com.situ.day9;

import org.junit.Test;

import java.util.ArrayList;

public class CollectionDemo {
    @Test
    public void test1() {
        //数组最大的问题是长度固定，而且要操作下标
        Student[] array = new Student[3];
        //ArrayIndexOutOfBoundsException
        //StringIndexOutOfBoundsException

        ArrayList<Student> list = new ArrayList();
        Student student1 = new Student();
        Student student2 = new Student();
        Student student3 = new Student();
        Student student4 = new Student();
        list.add(student1);
        list.add(student2);
        list.add(student3);
        list.add(student4);
        for (Student student : list) {
            System.out.println(student);
        }

    }

}
